import request from "@/utils/request";

// 登录方法

export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  };
  return request({
    url: "/dbo/login",
    headers: {
      isToken: false,
      repeatSubmit: false
    },
    method: "post",
    data: data
  });
}

// 注册方法
export function register(data) {
  return request({
    url: "/dbo/register",
    headers: {
      isToken: false
    },
    method: "post",
    data: data
  });
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: "/dbo/getInfo",
    method: "get"
  });
}

// 退出方法
export function logout() {
  return request({
    url: "/dbo/logout",
    method: "post"
  });
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: "/dbo/captchaImage",
    headers: {
      isToken: false
    },
    method: "get",
    timeout: 20000
  });
}
//数据字典
export const getOptionselect = () => {
  return request({
    url: "/dbo/system/dict/type/getAll",
    method: "get"
  });
};

/**
 * 模拟验证码登录
 * @property { Object } params
 * @param { String } params.mobile
 */
export const loginByCaptcha = params => {
  return request({
    url: "/dbo/sms/smsCode",
    method: "get",
    params
  });
};
